NextJs / View / Variables in view page
Variables in view page
-
1. Files
{ } is used to show the data in the view page 1. Single Value
const name="manoj"; export default function Home() { return ( {name}) }2. Multiple Value
const data = [ { uid: 21, name: ' Home', id: 1, path: '/' }, { uid: 31, name: 'Blog', id: 2, path: 'Blog' }, { uid: 41, name: 'About', id: 3, path: 'About' } ]; export default function Home() { return ( -
{data.map((value) => {
return (
- {value.name} ); })}
Note that the key 'map'. It is used for looping the array of object